﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Speech.Recognition;

namespace WPF_ActiveDataObject
{
    using JGTM.WPF.ActiveDataObject;

    public partial class App : Application
    {
        // Setup active properties for types upon app startup
        protected override void OnStartup(StartupEventArgs e)
        {
            // timer-based updating trigger
            ActiveObjectServices.MakeAlive<DateTime>("Now", TimeSpan.FromSeconds(1));

            // event-based updating triggers for activating existing properties
            ActiveObjectServices.MakeAlive<SpeechRecognitionEngine>("AudioState", "AudioStateChanged");
            ActiveObjectServices.MakeAlive<SpeechRecognitionEngine>("AudioLevel", "AudioLevelUpdated");

            // event-based updating triggers for publishing event args as active properties
            typeof(SpeechRecognitionEngine).CreateEventArgsProperty<AudioSignalProblemOccurredEventArgs>(
                "AudioSignalProblem", "AudioSignalProblemOccurred");
            typeof(SpeechRecognitionEngine).CreateEventArgsProperty<SpeechHypothesizedEventArgs>(
                "Hypothesization", "SpeechHypothesized");

            base.OnStartup(e);
        }
    }
}
